//
//  AppDelegate.m
//  MyFirstApp
//
//  Created by qianfeng on 15/7/27.
//  Copyright (c) 2015年 苑心刚. All rights reserved.
//

#import "AppDelegate.h"

#define RGB(r,g,b,a) 

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    //初始化并实例化一个windows
    //可以看做是一个画板 可以作画 但是多半是用来做画的支撑的架子 参考写生的本架子
    //[UIScreen mainScreen]  UIScreen:屏幕信息
    //[UIScreen mainScreen].bounds]取得也是视图的偏移和大小信息和Frame是一样的
    //bounds和Frame的区别是什么？参考的坐标系不同
    //bounds是将自己作为参考origin参数的{x，y}恒为{0，0}
    //frame是将自己融入到父视图的坐标体系所以origin不是恒为{0，0}而是参考对于父视图的x轴偏移和y轴偏移
    self.window=[[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]autorelease];
    //self.window=[[[UIWindow alloc]initWithFrame:CGRectMake(10, 30, 100, 100)]autorelease];
    
    //将windows的背景设置为白色
    //UIColor ui开发中所有用到的颜色都在这里面
    //封装的有默认的颜色 但是基本上用的最多的时设置RGB值来定制颜色
    self.window.backgroundColor=[UIColor whiteColor];
    self.window.backgroundColor=RGB(115.0/255.0, 125.0/255.0, 115.0/255.0, 1.f);
    //将windows设置为主视窗并且可见
    [self.window makeKeyAndVisible];
    // Override point for customization after application launch.
    return YES;
}
//应用即将进入活跃状态
/*
状态类型：1，活跃状态 2，挂起状态 3，被杀死
 1：活跃状态=》应用展示在界面上，是用户当前正在使用的状态
 2：挂起状态=》在挂起状态下还可以执行的功能
    2.1 VoIp电话
    2.2 推送
    2.3 定位
    2.4 音乐播放
    2.5 蓝牙信息共享
    2.6 文件共享
    2.7 下载
 3：被杀死=》彻底将应用从后台总终结掉，ios7.0以前点击小叉号关闭应用，ios7.0以后进入常用列表，执行上滑操作关闭应用
 */
//应用即将失去活跃状态
- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    NSLog(@"应用程序即将失去活跃状态");
}

//应用已经进入后台
- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    NSLog(@"应用程序已经进入后台");
}

//应用程序即将进入前台
- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    NSLog(@"应用程序即将进入前台");
}

//应用程序已经进入活跃状态
- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    NSLog(@"应用程序已经进入活跃状态");
}

//程序将要被杀死
- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    NSLog(@"程序将要终结");
}

@end
